package com.xiachufang.app.dao;

import com.xiachufang.app.entity.Category;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface CategoryDao extends JpaRepository<Category, Integer> {

    @Query("select c from Category c where c.home = true")
    List<Category> getHome();

    @Query("select c from Category c where c.name like :name")
    Page<Category> findPage(Pageable pageRequest, String name);
}
